﻿Public Class DateRangeDialog

    Public Property LowerBoundary As Date
    Public Property UpperBoundary As Date

    Public Sub New()

        InitializeComponent()
        dtp_LowerBoundary.MaxDate = Date.Now
        dtp_UpperBoundary.MaxDate = Date.Now

        dtp_UpperBoundary.Value = Date.Now
        dtp_LowerBoundary.Value = Date.Now.AddMonths(-1)
    End Sub

    Private Sub dtp_UpperBoundary_ValueChanged(sender As System.Object, e As System.EventArgs) Handles dtp_UpperBoundary.ValueChanged
        dtp_LowerBoundary.MaxDate = dtp_UpperBoundary.Value
    End Sub


    Private Sub btn_Accept_Click(sender As System.Object, e As System.EventArgs) Handles btn_Accept.Click
        LowerBoundary = dtp_LowerBoundary.Value.Date
        UpperBoundary = dtp_UpperBoundary.Value.Date

        Me.DialogResult = Windows.Forms.DialogResult.OK
        Me.Close()
    End Sub

End Class